﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AzureTosser.Services
{
    public class PipeTypes
    {
        public const string multicast_send = "multicast_send";
        public const string multicast_duplex = "multicast_duplex";
        public const string unicast_send = "unicast_send";
        public const string unicast_duplex = "unicast_duplex";
        public const string receive = "receive";
        public static PipeType GetPipeType(string type)
        {
            if (string.IsNullOrEmpty(type))
                throw new ArgumentException("pipe type string is empty.");
            switch (type.ToLower().Trim())
            {
                case multicast_send:
                    return PipeType.MulticastSend;
                case multicast_duplex:
                    return PipeType.MulticastDuplex;
                case unicast_send:
                    return PipeType.UnicastSend;
                case unicast_duplex:
                    return PipeType.UnicastDuplex;
                case receive:
                    return PipeType.Receive;
                default:
                    throw new ArgumentException(string.Format("Invalid pipe type string '{0}'", type));
            }
        }
    }
}